/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio.practica3;

import java.text.NumberFormat;

/**
 *
 * @author manolo
 */
public class Cuadrado extends Poligono {

    private Punto[] cuadrado = new Punto[4];

    public Cuadrado(int lados, Punto centro, Punto vertice) {
        super(lados, centro, vertice);
        for (int i = 0; i < lados; i++) {
            cuadrado[i] = super.getPunto(i);
        }

        System.out.println(this.toString());
    }

    @Override
    public String toString() {
        NumberFormat nf = NumberFormat.getInstance();
        String cadena = "Cuadrado{ ";

        for (int i = 0; i < 4; i++) {
            cadena += "(" + nf.format(cuadrado[i].getX()) + ", " + nf.format(cuadrado[i].getY()) + ")";
        }

        return cadena += "}";
    }
}
